package com.lzxuni.modules.Seed.service.impl;

import com.lzxuni.common.utils.HumpUtils;
import com.lzxuni.modules.Seed.entity.SeedLimit;
import com.lzxuni.modules.Seed.mapper.SeedLimitMapper;
import com.lzxuni.modules.Seed.service.SeedLimitService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzxuni.modules.common.entity.PageParameter;
import org.springframework.stereotype.Service;
import java.util.List;
import com.lzxuni.common.utils.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * <p>
 * 天气信息_苗青管理_临界值 服务实现类
 * </p>
 *
 * @author LaoNa
 * @since 2020-12-07
 */
@Service
public class SeedLimitServiceImpl extends ServiceImpl<SeedLimitMapper, SeedLimit> implements SeedLimitService {

        @Override
        public PageInfo<SeedLimit> queryPage(PageParameter pageParameter, SeedLimit seedLimit) {
            if (StringUtils.isNotEmpty(pageParameter.getSidx())) {
                PageHelper.startPage(pageParameter.getPage(), pageParameter.getRows()).setOrderBy(
                        HumpUtils.humpToLine(pageParameter.getSidx()) + " " + pageParameter.getSord());
            } else {
                PageHelper.startPage(pageParameter.getPage(), pageParameter.getRows());
            }
            List<SeedLimit> seedLimitList = baseMapper.queryList(seedLimit);
            PageInfo<SeedLimit> pageInfo = new PageInfo<>(seedLimitList);
            return pageInfo;
        }

        @Override
        public List<SeedLimit> queryList(SeedLimit seedLimit) {
            List<SeedLimit> seedLimitList = baseMapper.queryList(seedLimit);
            return seedLimitList;
        }

}
